package com.whw.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.whw.entity.Student;
import com.whw.service.StudentClientService;

@RestController
@RequestMapping("/student")
public class StudentConsumerFeignController {
	
	@Autowired
	private StudentClientService studentClientService;
	
	@PostMapping("/save")
	public boolean save(Student student){
		return studentClientService.save(student);
	}
	
	@GetMapping("/list")
	public List<Student>list(){
		return studentClientService.list();
	}
	
	@GetMapping("/get/{id}")
	public Student get(@PathVariable("id")Integer id){
		return studentClientService.get(id);
	}
	
	@GetMapping("/delete/{id}")
	public boolean delete(@PathVariable Integer id){
		return studentClientService.delete(id);
	}
	
	@GetMapping("/getInfo")
	public Map<String, Object> getInfo(){
		return studentClientService.getInfo();
	}
}
